<?php
    @include_once("conn.php");

    $id = $_GET["id"];   // 可以接受一个或多个id编号(82,83,84,85,86)
    if(!$id){
        argErr();
    }

    $del = "delete from `shoppingcar` where id in ($id)";
    mysqli_query($conn,$del);

    $rows = mysqli_affected_rows($conn);
    // 增删改  返回 => 受影响的行数(用不着接收结果对象了).
    // $rows > 0  删除成功
    // $rows == 0  删除失败 (语句执行成功 但是没有该数据)
    // $rows = -1  删除失败  语句执行有误

    // echo $rows;

    $obj = array();
    if($rows>0){
        $obj["status"] = true;
        $obj["detail"] = "删除成功";
    }else if($rows == 0){
        $obj["status"] = false;
        $obj["detail"] = "数据已被删除";
    }else{
        $obj["status"] = false;
        $obj["detail"] = "删除失败,sql语句有误";
        $obj["sql"] = $del;
    }

    echo json_encode($obj);


?>